<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  
  <head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" th:href="@{/pages/favicon.ico}" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" th:href="@{/pages/css/font.css}" href="./css/font.css">
    <link rel="stylesheet" th:href="@{/pages/css/xadmin.css}" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" th:src="@{/pages/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/pages/js/xadmin.js}" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body">
        <form class="layui-form" >
            <input type="hidden" name="platformId" th:value="${platformId}"/>
          <div class="layui-form-item">
              <label for="projectName" class="layui-form-label">
                  <span class="x-red">*</span>计划名称
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="projectName" name="projectName" lay-verify="required" class="layui-input"/>
              </div>
              <label for="invesBelong" class="layui-form-label">
                  <span class="x-red">*</span>投资区间
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="invesBelong" name="invesBelong" lay-verify="required" class="layui-input"/>
              </div>
          </div>
            <div class="layui-form-item">
                <label for="investRebate" class="layui-form-label">
                    <span class="x-red">*</span>返利
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="investRebate" name="investRebate" lay-verify="required" class="layui-input"/>
                </div>
                <label for="usedRed" class="layui-form-label">
                    <span class="x-red">*</span>是否可用红包
                </label>
                <div class="layui-input-inline" id="usedRed">
                    <input type="radio" name="usedRed" value="0" title="是">
                    <input type="radio" name="usedRed" value="1" title="否" checked>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="platformInterest" class="layui-form-label">
                    <span class="x-red">*</span>平台利息
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="platformInterest" name="platformInterest" lay-verify="required" class="layui-input"/>
                </div>
                <label for="earning" class="layui-form-label">
                    <span class="x-red">*</span>总收益
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="earning" name="earning" lay-verify="required" class="layui-input"/>
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn" lay-submit="" lay-filter="add">增加</button>
            </div>

      </form>
    </div>
    <script>
        layui.use(['form','layer','laydate'], function(){
            $ = layui.jquery;
          var form = layui.form,
            laydate = layui.laydate,
          layer = layui.layer;

          //自定义验证规则
          form.verify({

          });

          //监听提交
          form.on('submit(add)', function(data){
              $.post("/manage/platformscheme/add",data.field,function (data,status,jqhr) {
                  if(jqhr.status==200){
                      layer.alert("保存成功", {icon: 6},function () {
                          // 获得frame索引
                          var index = parent.layer.getFrameIndex(window.name);
                          //关闭当前frame
                          parent.layer.close(index);
                          parent.location.replace(parent.location.href);
                      });
                  }else{
                      layer.msg(data,{icon:2,time:1000});
                  }
              });
              return false;
          });

        });
    </script>
  </body>

</html>